In [1]:
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
sns.set_style('whitegrid')
In [3]:
titanic = sns.load_dataset('titanic')
In [4]:
titanic.head()
Out[4]:
Jointplot comparing fare and age
In [6]:
sns.jointplot(x='fare',y='age',data=titanic)
Out[6]:
Plot the fare column as distribution
In [8]:
sns.distplot(titanic['fare'],bins=30,kde=False,color='red')
Out[8]:
Displaying passenger and age over a boxplot
In [10]:
sns.boxplot(x='class',y='age',data=titanic,palette='rainbow')
Out[10]:
In [12]:
sns.swarmplot(x='class',y='age',data=titanic,palette='Set2')
Out[12]:
A simple count plot displying the number of passanger by sex
In [14]:
sns.countplot(x='sex',data=titanic)
Out[14]:
A heatmap showing the correlations for the entire dataset
In [16]:
sns.heatmap(titanic.corr(),cmap='coolwarm')
plt.title('titanic.corr()')
Out[16]:
Two histograms ploted using FacetGrid based on age and sex
In [18]:
g = sns.FacetGrid(data=titanic,col='sex')
g.map(plt.hist,'age')
Out[18]: